class Motherboard < ActiveRecord::Base
  attr_accessible :description, :price, :title, :product_url, :agp, :dimensions, :factor, :memslots, :memtype, :pci16, :pcie, :pcislots, :procspeed, :socket
  acts_as_heir_of :product

  validates :description, :price, :title, :product_url, :agp, :dimensions, :factor, :memslots, :memtype, :pci16, :pcie, :pcislots, :procspeed, :socket, presence: true
  validates :price, numericality: {greater_than_or_equal_to: 0.01}
  validates :procspeed, numericality: {greater_than_or_equal_to: 1800}
  #validates :title, uniqueness: true  ---> En la clase padre
  validates :agp, :pcislots, :pcie, :pci16, numericality: {greater_than_or_equal_to: 0}
  # regex para dimensions
  validates :dimensions, :format => {:with => /^([0-9]+[x])([0-9]+[x])([0-9]+)$/}
end
